//
//  CBPeripheral+RSSI.m
//  EKLLighting
//
//  Created by sunbinbin on 2020/12/16.
//

#import "CBPeripheral+RSSI.h"
#import <objc/runtime.h>

char nameKey;
char advertiseKey;
char snCodeKey;
char authorizedKey;


@implementation CBPeripheral (RSSI)

- (void)setRssi:(NSNumber *)rssi{
    objc_setAssociatedObject(self, &nameKey, rssi, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

- (NSNumber *)rssi{
    return objc_getAssociatedObject(self, &nameKey);
}

-(void)setAdvertisementData:(NSDictionary *)advertisementData {
    objc_setAssociatedObject(self, &advertiseKey, advertisementData, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

-(NSDictionary *)advertisementData {
    return objc_getAssociatedObject(self, &advertiseKey);
}


-(void)setSnCode:(NSString *)snCode{
    objc_setAssociatedObject(self, &snCodeKey, snCode, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

-(NSString *)snCode{
    return objc_getAssociatedObject(self, &snCodeKey);
}


-(void)setAuthorized:(NSNumber *)authorized{
    objc_setAssociatedObject(self, &authorizedKey, authorized, OBJC_ASSOCIATION_COPY_NONATOMIC);
}

-(NSNumber *)authorized{
    return objc_getAssociatedObject(self, &authorizedKey);
}

@end
